package com.dongjiantong.openplatform.core;/**
 * Created by cao on 2017/12/13.
 */

/**
 * @author cao
 * @create 2017-12-13 下午7:47
 **/

import com.dongjiantong.openplatform.entity.OPMode;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(
        prefix = "openplatform"
)
public class OpenProperties {
    private OPMode mode;
    private boolean debug;
    private int pushConnectTimeOut;
    private int pushReadTimeout;

    public OpenProperties() {
        this.mode = OPMode.GATEWAY;
        this.debug = Boolean.FALSE.booleanValue();
        this.pushConnectTimeOut = 3000;
        this.pushReadTimeout = 3000;
    }

    public OPMode getMode() {
        return this.mode;
    }

    public boolean isDebug() {
        return this.debug;
    }

    public int getPushConnectTimeOut() {
        return this.pushConnectTimeOut;
    }

    public int getPushReadTimeout() {
        return this.pushReadTimeout;
    }

    public void setMode(OPMode mode) {
        this.mode = mode;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public void setPushConnectTimeOut(int pushConnectTimeOut) {
        this.pushConnectTimeOut = pushConnectTimeOut;
    }

    public void setPushReadTimeout(int pushReadTimeout) {
        this.pushReadTimeout = pushReadTimeout;
    }

    @Override
    public boolean equals(Object o) {
        if(o == this) {
            return true;
        } else if(!(o instanceof OpenProperties)) {
            return false;
        } else {
            OpenProperties other = (OpenProperties)o;
            if(!other.canEqual(this)) {
                return false;
            } else {
                Object this$mode = this.getMode();
                Object other$mode = other.getMode();
                if(this$mode == null) {
                    if(other$mode == null) {
                        return this.isDebug() != other.isDebug()?false:(this.getPushConnectTimeOut() != other.getPushConnectTimeOut()?false:this.getPushReadTimeout() == other.getPushReadTimeout());
                    }
                } else if(this$mode.equals(other$mode)) {
                    return this.isDebug() != other.isDebug()?false:(this.getPushConnectTimeOut() != other.getPushConnectTimeOut()?false:this.getPushReadTimeout() == other.getPushReadTimeout());
                }

                return false;
            }
        }
    }

    public boolean canEqual(Object other) {
        return other instanceof OpenProperties;
    }

    @Override
    public int hashCode() {
       // int PRIME = true;
        int result = 1;
        Object $mode = this.getMode();
        result = result * 31 + ($mode == null?0:$mode.hashCode());
        result = result * 31 + (this.isDebug()?1231:1237);
        result = result * 31 + this.getPushConnectTimeOut();
        result = result * 31 + this.getPushReadTimeout();
        return result;
    }

    @Override
    public String toString() {
        return "OpenProperties(mode=" + this.getMode() + ", debug=" + this.isDebug() + ", pushConnectTimeOut=" + this.getPushConnectTimeOut() + ", pushReadTimeout=" + this.getPushReadTimeout() + ")";
    }
}
